package com.pubinfo.passbook.api.controller.rule;

import com.pubinfo.passbook.common.entity.TRuleDiseases;
import com.pubinfo.passbook.common.model.dto.rule.RuleDiseasesParam;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.model.vo.base.MyPage;
import com.pubinfo.passbook.common.service.master.TRuleDiseasesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("diseases/manager")
@Api(tags = "病种管理")
public class TDiseasesController {
  
  @Resource
  private TRuleDiseasesService diseasesService;
  
  @PostMapping("save")
  @ApiModelProperty("新增病种")
  public JsonResult<String> saveRuleDiseases(@RequestBody TRuleDiseases diseases) {
    return diseasesService.saveRuleDiseases(diseases);
  }
  
  @DeleteMapping("remove")
  @ApiModelProperty("删除病种")
  public JsonResult<Boolean> removeRuleDiseases(String diseasesId) {
    return JsonResult.success(diseasesService.removeById(diseasesId));
  }
  
  @PostMapping("select")
  @ApiModelProperty("查询病种")
  public JsonResult<MyPage<TRuleDiseases>> selectDiseases(@RequestBody RuleDiseasesParam param) {
    return JsonResult.success(new MyPage(diseasesService.selectRuleDiseases(param)));
  }
  
  @PostMapping("update")
  @ApiModelProperty("修改病种")
  public JsonResult<String> updateRuleDiseases(@RequestBody TRuleDiseases diseases) {
    return diseasesService.updateRuleDiseases(diseases);
  }
}
